<template>
  <div>
    <div class="hello">
      <div class="wp1080 cf">
        <el-col :span="24">
          <rootPath-view :child-msg="current"></rootPath-view>
        </el-col>
        <el-col :span="16" class="right-border">
          <div class="left-header">
            <div class="title">
              <div>Up主推荐</div>
              <span @click="type=true" :class="[{ bjBlue: type }]">最新</span>
              <span @click="type=false" :class="[{ bjBlue: !type }]">热门</span>
            </div>
          </div>
          <div class="leftList">
            <el-col :span="8" v-for="item in dataList" :key="item.id">
              <leftList-view v-if="type" :child-msg="item"></leftList-view>
            </el-col>
            <el-col :span="8" v-for="item in dataList" :key="item.id">
              <leftList-view v-if="!type" :child-msg="item"></leftList-view>
            </el-col>
          </div>
        </el-col>
        <el-col :span="7" :offset="1">
          <div class="right-border" style="height: 884px;overflow: hidden;box-sizing: border-box;">
            <div class="right-title">热门推荐</div>
            <el-col :span="24" v-for="item in dataList" :key="item.id">
              <introduceList-view @toDetail="toDetail" :child-msg="item"></introduceList-view>
            </el-col>
          </div>
        </el-col>
      </div>
    </div>
    <easyfooter></easyfooter>
  </div>
</template>

<script>
import leftList from '../components/leftList.vue'
import introduceList from '../components/introduceList.vue'
import rootPath from '../components/rootPath.vue'
import easyfooter from '../components/easy-footer.vue'

export default {
  name: 'classify',
  components: {
    'leftList-view': leftList,
    'introduceList-view': introduceList,
    'rootPath-view': rootPath,
    'easyfooter': easyfooter
  },
  data () {
    return {
      msg: '',
      current:'Up主推荐'
    }
  },
  created () {
    let searchAPI = '/pc/gamesByTag/' + this.$route.query.tag
    let that = this
    this.searchWord = this.$route.query.text
    // 此地有传auth(token)认证 为空就不会执行
    this.$request.get(searchAPI, false,
      function (res) {
        if (res.data.code === 1000) {
          that.dataList = res.data.rst
        }
      }
    )
  }
}
</script>
<style scoped>
  .left-header .title{
    height: 30px;
    line-height: 30px;
    width: 100%;
    padding: 0 0 15px 0;
  }
  .left-header div{
    float: left;
    color: rgba(115, 115, 115, 1);
    font-size: 20px;
    text-align: left;
    font-family: Roboto;
  }
  .left-header span{
    cursor: pointer;
    float: right;
    color: rgba(115, 115, 115, 1);
    font-size: 14px;
    text-align: right;
    font-family: Roboto;
    padding: 0 5px;
  }
  .leftList{
    clear: both;
  }
  .bjBlue{
    color: #009688 !important;
  }
</style>
